﻿using System;
using TechTalk.SpecFlow;
using UnityScenarios;
using OpenQA.Selenium;
using OpenQA.Selenium.Support;
using OpenQA.Selenium.Support.UI;
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Firefox;
using NUnit.Framework;
using OpenQA.Selenium.Remote;
using OpenQA.Selenium.Support.PageObjects;
using System.Threading;

namespace UnityScenarios
{
    [Binding]
    public class NewUserLoginSteps
    {
        [Given]
        public void Given_i_input_Current_Password()
        {
            var ie = ScenarioContext.Current["browser"] as FirefoxDriver;
            ie.FindElement(By.Name("CurrentPassword")).SendKeys("Tester147");
        }

        [Given]
        public void Given_I_input_new_password()
        {
            var ie = ScenarioContext.Current["browser"] as FirefoxDriver;
            ie.FindElement(By.Id("NewPassword")).SendKeys("Password147");
        }

        [Given]
        public void Given_I_input_the_same_new_password()
        {
            var ie = ScenarioContext.Current["browser"] as FirefoxDriver;
            ie.FindElement(By.Id("ConfirmNewPassword")).SendKeys("Password147");
        }

        [When]
        public void When_I_click_on_the_Submit_Button()
        {
            var ie = ScenarioContext.Current["browser"] as FirefoxDriver;
            ie.FindElement(By.CssSelector(".floatright.submitbtn.txtcentre")).Click();

        }

        [Then]
        public void Then_the_Home_page_is_displayed()
        {

            var ie = ScenarioContext.Current["browser"] as FirefoxDriver;
            ie.PageSource.Contains("btnlogout");
            ie.Close();
            ie.Dispose();
        }

    }
}
